package jzOffer;

public class Num62 {
    //约瑟夫环问题，详解见剑指offer P303
    public int lastRemaining(int n, int m) {
        int res=0;
        for(int i=2;i<=n;i++){
            res=(res+m)%i;
        }
        return res;
    }
}
